<template>
  <el-breadcrumb separator="/">
    <el-breadcrumb-item v-for="(item, index) in beradList" :key="item.path">
      <router-link to="/" v-if="index == 0">
        {{ item.meta.title }}
      </router-link>
      <span v-else>{{ item.meta.title }}</span>
    </el-breadcrumb-item>
  </el-breadcrumb>
</template>

<script>
import socket from './../socket'
export default {
  name: 'Breadcrumbs',
  computed: {
    beradList () {
      return this.$route.matched;
    },
  },
  mounted () {
    /** 登录 */
    socket.emit('login', this.$store.state.userInfo)
    /** 消息接收 */
    socket.on('pushMessage', msg => {
      this.$store.commit('saveUserMessage', msg)
    })
  }
}
</script>